<template>
  <div>
    <div class="contact">
      <div class="main-qq" @click="goim()">
        <img src="../../../static/home/zaixianzix.png" alt="">
        <p>在线咨询</p>
      </div>
      <div class="main-phone" :style="{width:drawer?'210px':'60px'}">
        <el-button @click="drawer = true" type="primary" append-to-body="false" class="phone-false" v-if="!drawer">
          <img src="../../../static/home/dianhuazixun.png" alt="">
          <p>在线咨询</p>
        </el-button>
        <el-drawer title="" :visible.sync="drawer" :with-header="false" class="phone-true" :modal="false"
          :show-close="false" :withHeader="false" :modal-append-to-body="false" :append-to-body="false" :size="'100%'">
          <img src="../../../static/home/dianhuazixun2.png" alt="" @click="closeDrawer">
          <span @click="closeDrawer">咨询电话</span>
          <p @click="closeDrawer">4006760286</p>
        </el-drawer>
      </div>
      <div class="main-fly" :style="{width:flyDrawer?'210px':'60px'}">
        <el-button @click="flyDrawer = true" type="primary" append-to-body="false" class="fly-false" v-if="!flyDrawer">
          <img src="../../../static/home/kffeiji.png" alt="">
          <p>Telegram</p>
        </el-button>
        <el-drawer title="" :visible.sync="flyDrawer" :with-header="false" class="fly-true" :modal="false"
          :show-close="false" :withHeader="false" :modal-append-to-body="false" :append-to-body="false" :size="'100%'"
          v-clipboard:copy="flyVal" v-clipboard:success="onCopy" v-clipboard:error="onError">
          <img src="../../../static/home/kffeiji2.png" alt="" @click="closeFlyDrawer">
          <span @click="closeFlyDrawer">请加好友</span>
          <el-tooltip content="点击复制" effect="light" placement="bottom-start">
            <p @click="closeFlyDrawer">@lumawang</p>
          </el-tooltip>
        </el-drawer>
      </div>
      <div class="top" @mouseenter="enter()" @mouseleave="leave()" :class="top?'top-true':'top-false'"
        @click="pageScroll">
        <img src="../../../static/home/top.png" alt="" v-if="!top">
        <p v-if="top">返回顶部</p>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    //import引入的组件需要注入到对象中才能使用
    components: {},
    data() {
      //这里存放数据
      return {
        drawer: false,
        direction: 'ltr',
        top: false,
        flyDrawer: false,
        flyVal: '@lumawang'
        // showContent: false,
        // Url: '../../../static/home/General_icon_Consulting@2x.png',
        // QQUrl: '../../../static/home/icon_QQ@2x.png',
        // ewmUrl: '../../../static/home/QQewm.png'
      };
    },
    //监听属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods: {
      //搜索
      // toggle() {
      //   this.showContent = !this.showContent;
      // },
      closeDrawer() {
        this.drawer = false
      },
      closeFlyDrawer() {
        this.flyDrawer = false
      },
      enter() {
        this.top = true;
      },
      leave() {
        this.top = false
      },
      pageScroll() {
        document.body.scrollTop = document.documentElement.scrollTop = 0;
      },
      goim() {
        window.open("http://wpa.qq.com/msgrd?v=3&uin=3007685427&site=qq&menu=yes")
      },
      onCopy(e) {
        // console.log(e);
        this.$message({
          type: "success",
          message: "复制成功!",
        });
      },
      // 复制失败
      onError(e) {
        alert("失败");
      },
    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {

    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {

    },
  }

</script>
<style scoped>
  .contact {
    margin-right: 10px;
    width: auto;
    height: auto;
    position: fixed;
    right: 0px;
    top: 30%;
    background-color: transparent;
    z-index: 99;
    border-radius: 4px 0px 0px 4px;
    cursor: pointer;
    border: none;
  }

  .main-qq {
    width: 60px;
    height: 105px;
    border: 0px;
    border-radius: 10px;
    background-image: linear-gradient(to bottom, #fa7116, #ed8d4e);
    text-align: center;
    position: absolute;
    right: 0px;
  }

  .main-qq img {
    width: 40px;
    margin-top: 5px;
  }

  .main-qq p {
    margin: 8px 10px 0px 10px;
    font-size: 16px;
    color: #fff;
    font-weight: 600;
  }

  .main-phone {
    height: 80px;
    background-color: transparent;
    border: 0px;
    margin: 0px;
    margin-top: 10px;
    padding: 0px;
    position: absolute;
    right: 0px;
    top: 100px;
  }


  .main-phone .phone-false {
    width: 60px;
    background-color: #fff;
    height: 80px;
    border-radius: 10px;
    border: 0px;
    padding: 0px;
  }

  .phone-false img {
    width: 40px;
    margin-top: 0px;
  }

  .phone-false p {
    margin: 5px 5px 0px 5px;
    font-size: 12px;
    color: #000;
    font-weight: 400;
    margin-top: 8px;
  }


  .phone-true {
    width: 210px;
    background-color: #fff;
    height: 80px;
    border-radius: 10px;
    margin: 0px;
    padding: 0px;
    position: absolute;
    /* overflow: inherit; */
  }

  .phone-true img {
    width: 40px;
    margin: 20px 10px 20px 10px;
    vertical-align: top;
    float: left;
  }

  .phone-true span {
    display: inline-block;
    color: #fff;
    font-size: 10px !important;
    margin: 18px 0px 0px 0px;
  }

  .phone-true p {
    display: inline-block;
    /* margin: 10px 0px 10px 0px; */
    font-size: 20px;
    line-height: 20px;
    color: #fff;
    font-weight: 600;
    vertical-align: top;
  }

  .main-fly {
    height: 80px;
    background-color: transparent;
    border: 0px;
    margin: 0px;
    margin-top: 10px;
    padding: 0px;
    position: absolute;
    right: 0px;
    top: 185px;
  }


  .main-fly .fly-false {
    width: 60px;
    background-color: #fff;
    height: 80px;
    border-radius: 10px;
    border: 0px;
    padding: 0px;
  }

  .fly-false img {
    width: 40px;
    margin-top: 0px;
  }

  .fly-false p {
    margin: 5px 5px 0px 5px;
    font-size: 12px;
    color: #000;
    font-weight: 400;
    margin-top: 8px;
  }


  .fly-true {
    width: 210px;
    background-color: #fff;
    height: 80px;
    border-radius: 10px;
    margin: 0px;
    padding: 0px;
    position: absolute;
    /* overflow: inherit; */
  }

  .fly-true img {
    width: 40px;
    margin: 20px 10px 20px 10px;
    vertical-align: top;
    float: left;
  }

  .fly-true span {
    display: inline-block;
    color: #fff;
    font-size: 10px !important;
    margin: 18px 0px 0px 0px;
  }

  .fly-true p {
    display: inline-block;
    /* margin: 10px 0px 10px 0px; */
    font-size: 20px;
    line-height: 20px;
    color: #fff;
    font-weight: 600;
    vertical-align: top;
  }

  .top {
    width: 60px;
    margin-top: 10px;
    height: 25px;
    text-align: center;
    border-radius: 5px;
    position: absolute;
    right: 0px;
    top: 270px;
  }

  .top-true {
    background-image: linear-gradient(to bottom, #fa7116, #ed8d4e);
  }

  .top-true p {
    font-size: 12px;
    color: #fff;
    line-height: 25px;
  }

  .top-false {
    background-color: #fff;
  }

  .top img {
    width: 25px;
    margin: 7px auto;
  }

</style>
<style>
  .phone-true .el-drawer__container {
    display: block;
    border-radius: 10px;
  }

  .phone-true .el-drawer__open .el-drawer.rtl {
    border-radius: 10px;
    display: block;
  }

  .phone-true .el-drawer__body {
    flex: none;
    display: block;
    overflow: initial;
    background-image: linear-gradient(to bottom, #fa7116, #ed8d4e);
    z-index: 100;
    height: 80px;
  }

  .fly-true .el-drawer__container {
    display: block;
    border-radius: 10px;
  }

  .fly-true .el-drawer__open .el-drawer.rtl {
    border-radius: 10px;
    display: block;
  }

  .fly-true .el-drawer__body {
    flex: none;
    display: block;
    overflow: initial;
    background-image: linear-gradient(to bottom, #fa7116, #ed8d4e);
    z-index: 100;
    height: 80px;
  }

</style>
